<?php
/**
 * Created by Zhy
 * User: Zhy
 * Date: 2018/8/2
 * Time: 10:10
 */

namespace app\api\model;


use think\Model;

class User extends Model
{
    //定义数据表
    protected $table = 'up_u_user';
    
    /**
     * 判断当前用户是否加入机构
     * @param $user_id  用户ID
     * @return mixed
     */
    public function joinMechanism($user_id){
        $res = $this->where('user_id', $user_id)
            ->field('user_to_mechanism_id, user_attestation')
            ->find();
        return $res;
    }

    /**
     * @param $id
     * @return array|false|\PDOStatement|string|Model
     * 查询用户数据
     */
    public function selectUserInfo($id,$field='*')
    {
        $where['user_id'] = $id;
        $res = $this->where($where)->field($field)->find();
        return $res;
    }
}